﻿@model IList<myMvcBlog.Post>
@foreach (var post in Model)
{ 
    <div class="post">
        <h2>
            @Html.ActionLink(post.Name, "View", new { controller = "Home", nicename = post.UrlName })
        </h2>
        <small>@post.PostedTime</small>
        <div class="entry">
            <p>
                @Html.Raw(post.Excerpt)
                @Html.ActionLink("阅读文章", "View", new { nicename = post.UrlName })
            </p>
        </div>
        <ul class="postmetadata">
            <li class="icon_comment icon_r">
                @Html.ActionLink(post.Comments.Count() + "条评论", "View", new { controller = "Home", nicename = post.UrlName })
            </li>
            <li class="icon_cat"><strong>Category:</strong>
                @foreach (var postCategory in post.PostCategories)
                {
                    var category = postCategory.Categories.ToList()[0];
                    @Html.ActionLink(category.Name, "View", new
                   {
                       controller = "Category",
                       nicename = category.UrlName
                   });

                }
            </li>
            <li class="icon_tag"><strong>Tags:</strong>
                @foreach (var postTag in post.PostTags)
                {
                    var tag = postTag.Tags.ToList()[0];
                    @Html.ActionLink(tag.Name + ", ", "View", new { controller = "Tag", nicename = tag.UrlName });
                }
            </li>
        </ul>
    </div>
}
